/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 *  Copyright 2021 Collate
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
 * Create StandardTest request
 * {"name":"testCase1","displayName":"testCase1","entityLink":"<#E::table::169数据库.dianli.public.device::columns::deviceid>","parameterValues":[],"testDefinition":"columnValuesToBeNotNull","description":"123","testSuite":"169数据库.dianli.public.device.testSuite","owner":{"id":"d47f9fbb-0a14-459f-bf7e-8a724b7434ff","type":"user"}}
 */
export interface CreateStandardTestArray {
    /**
     * 测试单体
     */
    standardTests: CreateStandardTestRequest[];
}

/**
 * Create StandardTest request
 * {"name":"testCase1","displayName":"testCase1","entityLink":"<#E::table::169数据库.dianli.public.device::columns::deviceid>","parameterValues":[],"testDefinition":"columnValuesToBeNotNull","description":"123","testSuite":"169数据库.dianli.public.device.testSuite","owner":{"id":"d47f9fbb-0a14-459f-bf7e-8a724b7434ff","type":"user"}}
 */
export interface CreateStandardTestRequest {
    /**
     * 对应的列信息，源.库.模式.表.列;173measure.measure_manage.public.dim_dept.id
     */
    columnFullyQualifiedName?: string;
    /**
     * 数据类型
     */
    dataType?: DataTypeClass;
    /**
     * 数据标准分类的描述
     */
    description: string;
    /**
     * 数据标准分类的展示名称
     */
    displayName?: string;
    /**
     * <#E::table::169数据库.dianli.public.device::columns::deviceid>
     */
    entityLink: string;
    /**
     * Unique identifier of this entity instance.
     */
    id?: string;
    /**
     * 最大出现次数
     */
    maximum?:  number;
    name:      string;
    provider?: ProviderType;
    /**
     * 是否必填
     */
    required?: boolean;
    /**
     * 所属的标准类型id
     */
    standardInfoId: string;
    /**
     * 值域
     */
    valueDomain?: ValueDomain;
}

/**
 * 数据类型
 *
 * 数据标准数据类型.
 *
 * 数据条件范围.
 */
export interface DataTypeClass {
    /**
     * condition1.
     */
    condition1?: string;
    /**
     * condition2.
     */
    condition2?: string;
    /**
     * opType of the data.
     */
    opType?: OpType;
    /**
     * opTypeShow of the data.["大于", "小于", "等于", "介于"]
     */
    opTypeShow?: string;
    /**
     * Type of the data.
     */
    type?: DataTypeType;
    /**
     * typeShow of the data.["字符串", "数字", "字符串或数字"]
     */
    typeShow?: string;
}

/**
 * opType of the data.
 */
export enum OpType {
    BT = "bt",
    Eq = "eq",
    Gt = "gt",
    Lt = "lt",
}

/**
 * Type of the data.
 */
export enum DataTypeType {
    All = "all",
    Int = "int",
    String = "string",
}

/**
 * Type of provider of an entity. Some entities are provided by the `system`. Some are
 * entities created and provided by the `user`. Typically `system` provide entities can't be
 * deleted and can only be disabled.
 */
export enum ProviderType {
    System = "system",
    User = "user",
}

/**
 * 值域
 *
 * 数据标准值域.
 */
export interface ValueDomain {
    /**
     * 编码表.
     */
    code?: string;
    /**
     * 数据条件范围.
     */
    dataCondition?: DataTypeClass;
    /**
     * 指定数据类型.
     */
    dataType?: DataTypeEnum;
    /**
     * 指定数据类型显示.["字符串", "数字"]
     */
    dataTypeShow?: string;
    /**
     * 其他标准.
     */
    otherStandard?: string;
    /**
     * 正则表达式.
     */
    regularExpression?: string;
    /**
     * Type of the data.
     */
    type: ValueDomainType;
    /**
     * typeShow of the data.["编码表", "数字条件范围", "指定数据类型","正则表达式", "其他标准"]
     */
    typeShow?: string;
}

/**
 * 指定数据类型.
 */
export enum DataTypeEnum {
    Number = "number",
    String = "string",
}

/**
 * Type of the data.
 */
export enum ValueDomainType {
    Code = "code",
    DataCondition = "dataCondition",
    DataType = "dataType",
    OtherStandard = "otherStandard",
    RegularExpression = "regularExpression",
}
